Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rancher cli - readable-world and readable-user warnings have no meaning on windows client #384

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fenchu
Copy link

@fenchu fenchu commented Aug 21, 2024

This warning have no meaning on windows:

PS C:\dist\dev\cli> rancher.exe context current
time="2024-08-21T15:08:25+02:00" level=warning msg="Rancher configuration file C:\\Users\\mobj\\.rancher\\cli2.json is group-readable. This is insecure."
time="2024-08-21T15:08:25+02:00" level=warning msg="Rancher configuration file C:\\Users\\mobj\\.rancher\\cli2.json is world-readable. This is insecure."
PS C:\dist\dev\cli> go build
Cluster:backend-test-osl Project:TSP
PS C:\dist\dev\cli> .\cli.exe context current
Cluster:backend-test-osl Project:TSP

}
if info.Mode()&0004 > 0 {
warnings = append(warnings, fmt.Sprintf("Rancher configuration file %s is world-readable. This is insecure.", path))
if runtime.GOOS != "windows" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should invert this conditional to avoid unneeded nesting

if runtime.GOOS == "windows" {
   return nil, nil
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love to see it implemented :-), Regards from the lonely windows user of ranchercli

@HarrisonWAffel
Copy link
Contributor

To other reviewers, this is needed as permission bits on Windows are not representative of the actual ACLs set for a given file. The owner bit is always used for all three bits on Windows, so this check will always fail, even if the file has restricted access to admins only (which it is by default)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants